#include<iostream>
#include<vector>
#include<map>
#include<unordered_map>
using namespace std;
/*
    出书最多题解
*/
unordered_map<char, vector<int>> mp;
int m, n;
char s[30];
void solve()
{
    cin >> m;
    for (int i = 1; i <= m; i++)
    {
        cin >> n >> s;
        for (int i = 0; s[i] != '\0'; i++)
        {// 对每个作者将其书名push进去
            mp[s[i]].push_back(n);
        }
    }
    int maxv = 0;
    vector<int> ans;
    char res;
    for (auto &[u, v] : mp) // 遍历map
    {
        if (v.size() > maxv)// 找到出书最多的作者
        {
            maxv = v.size();
            res = u;
            ans.clear();
            ans.assign(v.begin(), v.end());// 将v的值赋值给ans
        }
    }
    cout << res << endl
         << ans.size() << endl;
    for (auto &c : ans)
    {
        cout << c << endl;
    }
}